package com.loong.seller.controller.forehead;

import com.loong.common.mvc.BaseForeheadController;
import com.loong.common.param.BaseIdParam;
import com.loong.common.rest.Result;
import com.loong.common.validator.group.CommonValidate;
import com.loong.seller.handler.DeliveryWaysHandler;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @Description: 配送方式控制 c端使用
 * @Author: hzp
 * @Date: 2020-11-9 9:28
 */
@RestController
@RequestMapping("/forehead/seller/deliveryWays")
public class DeliveryWaysForeheadController extends BaseForeheadController {
    @Resource
    private DeliveryWaysHandler deliveryWaysHandler;

    /**
     * 查询所有的配送方式  c端使用
     * @return
     */
    @PostMapping("findAll")
    public Result findAllDeliveryWays(){
        return handlerExecutor.execute(()->deliveryWaysHandler.findAll());
    }

    /**
     * 根据店铺id查找配送方式 只查有的没有的不显示 c端使用
     * @param param
     * @return
     */
    @PostMapping("findDeliveryWays")
    public Result findDeliveryWaysByShop(@RequestBody @Validated(value = {CommonValidate.class}) BaseIdParam param){
        return handlerExecutor.execute(()->deliveryWaysHandler.findDeliveryWaysByShopIdForehead(param.getId()));

    }
}
